﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Model;

namespace ValuationDAL
{
   public class DepartmentDAL
   {
       #region 部门信息
       //显示部门信息
       public List<SysDepartment> DepartmentList()
       {
           string sql = "select * from dbo.SysDepartment";
           return DBHelper.ExecuteObjects<SysDepartment>(sql);
       }
       #endregion

       #region 根据部门编号显示对应的员工
       //根据部门编号显示对应的员工
       public List<SysUser> DepartmentUser(int department_Id, int RolesId)
       {
           string sql = @"select * from dbo.SysUser a join SysDepartment b
                            on a.department_id=b.department_id join dbo.SysRoles c 
                            on a.Roles_Id=c.Roles_Id
                            where b.department_id=" + department_Id + " and c.Roles_Id=" + RolesId;
           return DBHelper.ExecuteObjects<SysUser>(sql);
       }
       #endregion
      
    }
}
